const std = @import("std");
const util = @import("util.zig");

pub fn main() !void {
    const allocator = std.heap.page_allocator;
    var args = std.process.args();
    defer args.deinit();

    // Skip program name
    _ = args.next();
    const cnf_path = args.next() orelse {
        std.debug.print("Usage: penponism <cnf_file>\n", .{});
        return error.InvalidArgs;
    };

    // Parse the CNF file
    const result = util.parseCNF(allocator, cnf_path) catch |err| {
        std.debug.print("Failed to parse CNF file: {s}\n", .{@errorName(err)});
        return err;
    };
    defer result.vecs.deinit();

    util.printStats(result);
    std.debug.print("Parsed CNF file: {s}\n", .{cnf_path});
    var i: usize = 0;
    for (result.vecs.items) |vec| {
        std.debug.print("Clause {d}: ", .{i + 1});
        vec.print("\n");
        i += 1;
    }
}
